//
//  MCCTableViewCell.swift
//  kxf
//
//  Created by Mac on 2024/3/7.
//

import Foundation
import UIKit

class MCCTableViewCell: UITableViewCell {
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.backgroundColor = .clear
        self.selectionStyle = .none
        initUI()
    }
    lazy var titleLabel : UILabel = {
        let lab = UILabel()
        lab.textColor = .COLOR_TEXT_BLACK666
        lab.numberOfLines = 2
        lab.lineBreakMode = .byCharWrapping
        lab.adjustsFontSizeToFitWidth = true
        lab.font = .systemFont(ofSize: 14)
        
        return lab
    }()
    lazy var lineView : UIView = {
        let vi = UIView()
        vi.backgroundColor = .COLOR_LIGHT_GREY
        
        return vi
    }()
}

extension MCCTableViewCell{
    func updateUIForMcc(dict:NSDictionary) {
        titleLabel.text = dict["mccName"]as? String ?? ""
    }
    func updateUIForWeChat(dict:NSDictionary) {
        titleLabel.text = dict["typeThree"]as? String ?? ""
    }
    func updateUIForBankBranch(dict:NSDictionary) {
        titleLabel.text = dict["branchBankName"]as? String ?? ""
    }
}
extension MCCTableViewCell{
    func initUI()  {
        contentView.addSubview(titleLabel)
        contentView.addSubview(lineView)
        
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(kFitWidth(20))
            make.right.equalTo(kFitWidth(-20))
            make.top.height.equalToSuperview()
        }
        lineView.snp.makeConstraints { make in
            make.left.equalTo(kFitWidth(10))
            make.right.equalTo(kFitWidth(-10))
            make.bottom.equalToSuperview()
            make.height.equalTo(kFitWidth(0.4))
        }
    }
}
